/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.projects.toolbox_basics_project.spring.manager;

import java.util.List;
import java.util.Locale;

import com.genia.toolbox.persistence.exception.PersistenceException;
import com.genia.toolbox.projects.toolbox_basics_project.bean.model.Language;

/**
 * DAO to handle {@link Language}.
 */
public interface LanguageManager
{

  /**
   * returns all {@link Language}s.
   * 
   * @return all {@link Language}s
   * @throws PersistenceException
   *           when an error occured
   */
  public List<Language> getAll()
      throws PersistenceException;



  /**
   * returns the {@link Language} associated to the current
   * {@link java.util.Locale}.
   * 
   * @return the {@link Language} associated to the current
   *         {@link java.util.Locale}
   * @throws PersistenceException
   *           when an error occured
   */
  public Language getCurrentLanguage()
      throws PersistenceException;



  /**
   * returns the default {@link Language}.
   * 
   * @return the default {@link Language}
   * @throws PersistenceException
   *           when an error occured
   */
  public Language getDefaultLanguage()
      throws PersistenceException;



  /**
   * returns a {@link Language} identified by its identifier.
   * 
   * @param identifier
   *          the identifier of the {@link Language} to return
   * @return a {@link Language} identified by its identifier
   */
  public Language getLanguage(Long identifier);



  /**
   * returns a {@link Language} identified by its locale.
   * 
   * @param locale
   *          the locale of the {@link Language} to return
   * @return a {@link Language} identified by its locale
   * @throws PersistenceException
   *           when an error occured
   */
  public Language getLanguage(Locale locale)
      throws PersistenceException;



  /**
   * returns a {@link Language} having exactly the given locale. If the language
   * does not exist, it will be created.
   * 
   * @param locale
   *          The {@link Locale} to get to {@link Language} for
   * @return a {@link Language} having exactly the given locale. If the language
   *         does not exist, it will be created
   * @throws PersistenceException
   *           if an error occured
   */
  public Language getOrCreateLanguage(Locale locale)
      throws PersistenceException;

}
